//
//  EFAUtyPromptVC.m
//  efairy
//
//  Created by XiangDongMBP on 2017/12/29.
//  Copyright © 2017年 East. All rights reserved.
//

#import "EFAUtyPromptVC.h"
#import <WebKit/WebKit.h>

@interface EFAUtyPromptVC ()

@property (weak,   nonatomic) IBOutlet UIButton *closeBtn;
@property (weak,   nonatomic) IBOutlet UIView *bgView;
@property (strong, nonatomic) WKWebView *webView;

@end

@implementation EFAUtyPromptVC

#pragma mark - life cycle
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self initNavigationBar];
    [self initSubViews];
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    
    self.webView.frame = self.bgView.bounds;
    self.webView.hidden = NO;
//    self.closeBtn.hidden = NO;
}
- (void)initNavigationBar {
    
}

- (void)initSubViews {
//    //创建网页配置对象
//    WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
//    // 创建设置对象
//    WKPreferences *preference = [[WKPreferences alloc]init];
//    // 设置字体大小(最小的字体大小)
//    preference.minimumFontSize = 16;
//    // 设置偏好设置对象
//    config.preferences = preference;

//    self.webView = [[WKWebView alloc] initWithFrame:self.bgView.bounds configuration:config];
    self.webView = [[WKWebView alloc] initWithFrame:self.bgView.bounds];
    self.webView.hidden = YES;
    [self.bgView addSubview:self.webView];
    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"敬告用户" ofType:@"docx"]];
    [self.webView loadRequest:[NSURLRequest requestWithURL:url]];
    
    [self.closeBtn addTarget:self action:@selector(closeBtnTapped:) forControlEvents:UIControlEventTouchUpInside];
//    self.closeBtn.hidden = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - delegate
#pragma mark - event response
- (void)closeBtnTapped:(UIButton *)btn {
    [self dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark - private methods
#pragma mark - network request
#pragma mark - getters and setters

@end
